# Plugins

- **Type:**

```ts
type Falsy = false | '' | 0 | null | undefined;

type Plugin =
  | RspackPluginInstance
  | RspackPluginFunction
  | WebpackPluginInstance
  | WebpackPluginFunction
  | Falsy;

type Plugins = Plugin[];
```

- **Default:** `[]`

The `plugins` option is used to register a set of Rspack or webpack plugins to customize the build process.

Please refer to [Plugins page](/guide/features/plugin) for more information on using plugins in Rspack.

## Built-in plugins

Rspack comes with a variety built-in plugins available under `rspack.PluginName`.

For example, [`DefinePlugin`](/plugins/webpack/define-plugin) allows you to replaces variables in your code with other values or expressions at compile time. You can access it via `rspack.DefinePlugin` and create a plugin instance with `new`:

```js title="rspack.config.mjs"
import { rspack } from '@rspack/core';

export default {
  //...
  plugins: [
    new rspack.DefinePlugin({
      // pass plugin options
    }),
  ],
};
```

## webpack plugins

Rspack strives to maintain compatibility with the webpack plugin ecosystem to leverage the excellent features that have been accumulated and validated by the community. Please refer to the [Plugin Compatibility List](/guide/compatibility/plugin) to access a list of webpack plugins that have passed our compatibility tests:

```js title="rspack.config.mjs"
import { rspack } from '@rspack/core';
import HtmlWebpackPlugin from 'html-webpack-plugin';

export default {
  //...
  plugins: [new HtmlWebpackPlugin()],
};
```

## Disable plugins

Rspack ignores `false`, `''`, `0`, `null` and `undefined` values in the `plugins` array, which allows you to easily disable a plugin.

For example, enable [HotModuleReplacementPlugin](/plugins/webpack/hot-module-replacement-plugin) only in the development environment:

```js title="rspack.config.mjs"
import { rspack } from '@rspack/core';

const isDev = process.env.NODE_ENV === 'development';

export default {
  plugins: [isDev && new rspack.HotModuleReplacementPlugin()],
};
```
